home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
COMPHELP
/
BATCHTUT.LZH
/
_QUERY.REM
< prev
next >
Wrap
Text File
|
1983-08-25
|
3KB
|
92 lines
Text File _query.rem
QUERY.COM
The purpose of the QUERY utility is to allow the user of a Batch File to answer
a prompting message or comment with a yes/no (or ESC) response. The QUERY
utility then sets the system "errorlevel" parameter so that a subsequent IF
subcommand in the Batch File can branch accordingly. QUERY will optionally
execute some display formatting commands before it displays a prompt string.
The format of the QUERY command line is shown below, with the usual convention
that items in brackets [ ] are optional.
QUERY [ / [ c1 [ c2 ... ] ] / ] [ string ]
where c1, c2, etc are optional formatting commands enclosed in slashes.
These commands are executed in the order they are encountered, before the
string is displayed. The one-letter commands that are currently supported
include the following:
B or b Beep the console
L or l Skip one line
D or d Display a "delimiting" border across the screen.
After the "slash" commands are executed, the string is displayed. If no
slashes precede the string, the leading blanks and tabs are discarded. If
slashes were present, then all characters after the second slash are
displayed.
The only constraint on the string's characters is that "<", "|", and ">" must
not be used in the string.
Following the string, a reverse video "box" is displayed. When the user
responds with a keystroke, the box "un-reverses" and the character is
displayed.
QUERY then returns to the Batch File with the errorlevel parameter set as
follows:
errorlevel = 2 if user typed Esc key
errorlevel = 1 if user typed Y or y
errorlevel = 0 if user typed N or n
If any other key is typed, the console is beeped, a message is displayed, and
QUERY waits for another keystroke.
Let's return to the Batch File to show some examples. The first example shows
the simplest use of QUERY and how to test the errorlevel code with subsequent
IF subcommands. We'll first display the command lines in these comments, and
then we will return to the Batch File and execute the same command lines.
Here are the command lines:
query Is this example easy (y/n) ?
if errorlevel 2 goto esc_key
if not errorlevel 1 goto n_key
echo You typed a "Y" or a "y"
goto continue
:n_key
echo You typed a "N" or an "n"
goto continue
:esc_key
echo you pressed the Esc key
:continue
Examine the command lines (remember that the logic of the "IF" test is "greater
than or equal to" and the "IF NOT" test, "less than" ), then strike a key and
we'll execute the sequence.